import React from 'react';
import { Table } from 'antd';
import { ListItemType, SummaryType } from '@/models/SsqPredictionData';

interface IProp {
  dataSource?: ListItemType[];
  summary?: SummaryType;
}

const SsqPredictionData: React.FC<IProp> = ({ dataSource = [], summary = {} }) => {

  const columns = [
    {
      key: 'code',
      dataIndex: 'code',
      title: '期号',
    },
    {
      key: 'date',
      dataIndex: 'date',
      title: '开奖日期',
    },
    {
      key: 'red1',
      dataIndex: 'red1',
      title: '红球1',
    },
    {
      key: 'red2',
      dataIndex: 'red2',
      title: '红球2',
    },
    {
      key: 'red3',
      dataIndex: 'red3',
      title: '红球3',
    },
    {
      key: 'red4',
      dataIndex: 'red4',
      title: '红球4',
    },
    {
      key: 'red5',
      dataIndex: 'red5',
      title: '红球5',
    },
    {
      key: 'red6',
      dataIndex: 'red6',
      title: '红球6',
    },
    {
      key: 'blue',
      dataIndex: 'blue',
      title: '蓝球',
    },
    {
      key: 'levelDesc',
      dataIndex: 'levelDesc',
      title: '预测结果',
    },
  ];
  return (
    <div>
      <p>共{summary.totalCount}次</p>
      <p>一等奖：命中{summary.level1Count}次</p>
      <p>二等奖：命中{summary.level2Count}次</p>
      <p>三等奖：命中{summary.level3Count}次</p>
      <p>四等奖：命中{summary.level4Count}次</p>
      <p>五等奖：命中{summary.level5Count}次</p>
      <p>六等奖：命中{summary.level6Count}次</p>
      <Table
        rowKey={record => record.code}
        columns={columns}
        dataSource={dataSource}
      />
    </div>
  );
};

export default SsqPredictionData;
